//
//  ReversiPlayer.m
//  Reversi
//
//  Created by 成瀬 龍人 on 2/14/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ReversiPlayer.h"


@implementation ReversiPlayer
- (id)initWithField:(NSControl*)x:(NSControl*)y{
	[super init];
	xPositionControl = x;
	yPositionControl = y;
	return self;
}

- (ReversiBoardPosition*)nextHand:(ReversiStone)aStone:(ReversiBoard*)aBoard{
	ReversiBoardPosition* pos;
	@try{
		pos = [[ReversiBoardPosition alloc] initWithString:
			   [xPositionControl stringValue]:
			   [yPositionControl stringValue]];
	}@catch (ReversiOutOfRangeException* e){
		NSLog(@"[%@]%@",e.name,e.reason);
		return nil;
	}
	if ([aBoard isPutOK:aStone:pos]){
		return pos;
	}
	return nil;
}
@end
